package com.eling.elcms.travel.model;

import com.eling.elcms.basedoc.model.OrgBuilding;
import com.eling.elcms.basedoc.model.RoomType;
import com.eling.elcms.core.dao.annotation.Between;
import com.eling.elcms.core.dao.annotation.CriteriaEnhancer;
import com.eling.elcms.core.dao.annotation.CriteriaEnhancers;
import com.eling.elcms.core.dao.annotation.In;
import com.eling.elcms.core.model.BaseModel;
import com.eling.elcms.ordermanager.model.ServicePoint;
import com.eling.elcms.privilege.service.impl.CommonPrivilegeCriteriaEnhancer;
import com.eling.elcms.system.model.CommonUser;
import org.hibernate.search.annotations.DocumentId;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.IndexedEmbedded;

import javax.persistence.*;
import java.util.Date;
/**
 * 房型定价
 * @author MoonJiDoo
 *
 */
@Entity
@Table(name = "travel_roomtypeprice")
@Indexed
@CriteriaEnhancers(criteriaEnhancers = { 
		@CriteriaEnhancer(impl = CommonPrivilegeCriteriaEnhancer.class, parameter = "servicePoint:servicePoint") })
public class RoomTypePrice extends BaseModel{


	private static final long serialVersionUID = -7826051002525241128L;

	/** 主键*/
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@DocumentId
	@In
	private Long pkRoomTypePrice;
	
	/** 所属服务点*/
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "pkServicePoint")
    @IndexedEmbedded(depth = 1)
	private ServicePoint servicePoint;
	
	/** 楼宇*/
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "pkOrgBuilding")
	@IndexedEmbedded(depth = 1)
	@In
	private OrgBuilding orgBuilding;
	
	/** 房型*/
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "pkRoomType")
	@IndexedEmbedded(depth = 1)
	@In
	private RoomType roomType;
	
	/**出售日期*/
	@Column
	@Field
	@Between
	private Date saleDate;
	
	/** 会员价*/
	@Column
	@Field
	private Double vipPrice;
	
	/** 标准价*/
	@Column
	@Field
	private Double standardPrice;
	
	/** 协议价*/
	@Column
	@Field
	private Double protocolPrice;
	
	/** 创建人*/
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "creater")
	@IndexedEmbedded(depth = 1)
	private CommonUser creater;
	
	/** 创建日期*/
	@Column
	@Field
	private Date createDate;
	
	@Version
	private Integer version;

	public Long getPkRoomTypePrice() {
		return pkRoomTypePrice;
	}

	public void setPkRoomTypePrice(Long pkRoomTypePrice) {
		this.pkRoomTypePrice = pkRoomTypePrice;
	}

	public ServicePoint getServicePoint() {
		return servicePoint;
	}

	public void setServicePoint(ServicePoint servicePoint) {
		this.servicePoint = servicePoint;
	}

	public OrgBuilding getOrgBuilding() {
		return orgBuilding;
	}

	public void setOrgBuilding(OrgBuilding orgBuilding) {
		this.orgBuilding = orgBuilding;
	}

	public RoomType getRoomType() {
		return roomType;
	}

	public void setRoomType(RoomType roomType) {
		this.roomType = roomType;
	}

	public Date getSaleDate() {
		return saleDate;
	}

	public void setSaleDate(Date saleDate) {
		this.saleDate = saleDate;
	}

	public Double getVipPrice() {
		return vipPrice;
	}

	public void setVipPrice(Double vipPrice) {
		this.vipPrice = vipPrice;
	}

	public Double getStandardPrice() {
		return standardPrice;
	}

	public void setStandardPrice(Double standardPrice) {
		this.standardPrice = standardPrice;
	}

	public Double getProtocolPrice() {
		return protocolPrice;
	}

	public void setProtocolPrice(Double protocolPrice) {
		this.protocolPrice = protocolPrice;
	}


	public CommonUser getCreater() {
		return creater;
	}

	public void setCreater(CommonUser creater) {
		this.creater = creater;
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public Integer getVersion() {
		return version;
	}

	public void setVersion(Integer version) {
		this.version = version;
	}
	
}
